<template>
    <div>
        <h2>科室信息显示列表</h2>
        <span>科室名称</span>
        <input type="text" v-model="quertInfo.departmen">
        <input type="button" value="查询" @click="GetDepartmentList" class="btn btn-warning ">
        <table class="table table-bordered">
            <tbody>
                <tr  class="bg bg-info ">
                    <td>科室编号</td>
                    <td>科室名称</td>
                    <td>科室图片</td>
                    <td>成立日期</td>
                    <td></td>
                </tr>
                <tr v-for="item in data1" :key="item.id">
                    <td>{{item.id}}</td>
                    <td>{{item.department}}</td>
                    <td>
                        <img :src="item.photo" alt="" width="100" height="100">
                    </td>
                    <td>{{moment(item.date).format('YYYY-MM-DD')}}</td>
                    <td></td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import {ref, reactive,onMounted} from 'vue'
import {useRouter, useRoute} from 'vue-router'
import axios from 'axios';
import moment from 'moment';
let router = useRouter()
let route = useRoute()
let data1:any= ref([])

let quertInfo= reactive({
    departmen: '',
})
onMounted(()=>{
    GetDepartmentList();
})
const GetDepartmentList = () => {
    axios({
        url: '/api/Department/GetDepartmentList',
        method: 'get',
        params: quertInfo
    })
    .then((res) => {
        console.log(res);
        console.log(quertInfo);

        data1.value = res.data;

    })
}
</script>

<style scoped>

</style>